import Vue from 'vue'
import Index from './tabbar.vue'
// import { AjaxPlugin } from 'vux'
// import { WechatPlugin } from 'vux'
import VueRouter from 'vue-router'
import axios from 'axios';

import homepage from './homepage.vue'
import personalCenter from './personal-center.vue'
import userModule from 'COMMON/user-module.js'

require('es6-promise').polyfill()

const FastClick = require('fastclick')
FastClick.attach(document.body)

Vue.use(VueRouter);
// Vue.use(WechatPlugin)
// Vue.use(AjaxPlugin)

Vue.config.productionTip = false

// edit: msg在res.data.msg res.data.data的话拿不到msg
axios.interceptors.response.use(res => {
  return res.data
})

const routes = [
  { path: '/', redirect: '/homepage' },
  { path: '/homepage', component: homepage, alias: "/" },
  { path: '/personal', component: personalCenter },
]

const router = new VueRouter({
  routes
});

window.DEBUGGING = -1<location.href.indexOf("localhost");
// window.DEBUGGING = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(Index)
})
